package com.sicau.socialpracticesystem.controller;


import com.sicau.socialpracticesystem.common.constant.UrlConstants;
import com.sicau.socialpracticesystem.common.myenum.CollegeEnum;
import com.sicau.socialpracticesystem.common.returning.ResultData;
import com.sicau.socialpracticesystem.entity.po.College;
import com.sicau.socialpracticesystem.service.CollegeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 学院表 前端控制器
 * </p>
 *
 * @author sxt && ttxxi
 * @since 2021-04-26
 */
@RestController
@PreAuthorize("isAuthenticated()")
@RequestMapping(UrlConstants.COLLEGE_PREFIX)
@Slf4j
@Api(tags = "学院相关")
public class CollegeController {

    @Resource
    private CollegeService collegeService;

    @GetMapping("/all")
    @ApiOperation("获取所有学院")
    public ResultData<List<College>> getAll(){
        return new ResultData<List<College>>().OK().setObj(CollegeEnum.getAllCollage());
    }

}

